import uiVite from 'ui-vite'
import { set, get } from 'idb-keyval'
export default {
    install(app: any) {
        app.use(uiVite)

        VConf.vicon.fun.getRes = async (url) => {
            let _val = await get(url)
            if (_val) _val = JSON.parse(_val)
            return _val || null
        }

        VConf.vicon.fun.setRes = (url, content) => {
            set(url, JSON.stringify(content))
        }

        VConf.vsicon.url = '/svg'
        VConf.vsicon.lib = ''

        VConf.vsicon.fun.getRes = async (url) => {
            let _val = await get(url)
            return _val || null
        }

        VConf.vsicon.fun.setRes = (url, content) => {
            set(url, content)
        }
    }
}
